var Mediator = Backbone.View.extend({
    initialize: function (options) {
        _.bindAll(this,"showRegistrationForm","hideRegistrationForm","closeAll", "showMakeMyDreamForm", "showWelcomeScreen", "hideWelcomeScreen", "showFindADreamStore", "hideMakeMyDreamForm", "hideFindADreamStore");
        this.channel = options.channel;
        this.channel.bind("cShowMakeMyDreamForm", this.showMakeMyDreamForm);
        this.channel.bind("cHideMakeMyDreamForm", this.hideMakeMyDreamForm);
        this.channel.bind("cShowWelcomeScreen", this.showWelcomeScreen);
        this.channel.bind("cHideWelcomeScreen", this.hideWelcomeScreen);
        this.channel.bind("cShowFindADreamStore", this.showFindADreamStore);
        this.channel.bind("cHideFindADreamStore", this.hideFindADreamStore);
        this.channel.bind("cShowRegistrationForm", this.showRegistrationForm);
        this.channel.bind("cHideRegistrationForm", this.hideRegistrationForm);
  this.channel.bind("cClearAll", this.closeAll);;

    },
    showRegistrationForm: function () {
        this.closeAll()
        this.channel.trigger("showRegistrationForm");
    },
    hideRegistrationForm: function () {
        this.channel.trigger("hideRegistrationForm");
    },
    showMakeMyDreamForm: function () {
        this.closeAll()
        this.channel.trigger("showMakeMyDreamForm");
    },
    hideMakeMyDreamForm: function () {
        this.channel.trigger("hideMakeMyDreamForm");
    },
    showWelcomeScreen: function () {
        this.closeAll();
        this.channel.trigger("showWelcomeScreen");
    },
    hideWelcomeScreen: function () {
        this.channel.trigger("hideWelcomeScreen");
    },
    hideWelcomeScreen: function () {
        this.channel.trigger("hideWelcomeScreen");
    },
    showFindADreamStore: function () {
        this.closeAll()
        this.channel.trigger("showFindADreamStore");
    },
    hideFindADreamStore: function () {
        this.channel.trigger("hideFindADreamStore");
    },
    closeAll: function(){
        this.channel.trigger("hideMakeMyDreamForm");
        this.channel.trigger("hideFindADreamStore");
        this.channel.trigger("hideRegistrationForm");
         $("#viewMyDream").hide();
    }


});